home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / signal / bode.dem next >
Text File  |  1999-09-16  |  1KB  |  45 lines

  1.                   //////////////////
  2.                   //BODE PLOTS//////
  3.                   //////////////////
  4.  
  5. //First plot using state space representation
  6. //
  7. //   xd=-2*%pi*x+u
  8. //    y=18*%pi*x+u
  9. //
  10. // h(s)=18*%pi/(s+2*%pi)
  11. //
  12.    a=-2*%pi;
  13.    b=1;
  14.    c=18*%pi;
  15.    d=1;
  16.    sl=syslin('c',a,b,c,d);ssprint(sl)
  17.    bode(sl,.1,100),
  18.    halt()
  19.    cw=xget("window");if cw>=1 then;ccw=cw-1;else ccw=cw+1;end
  20.    xbasc(cw);   xbasc(ccw);
  21. //Second plot using poly
  22.    s=poly(0,'s');
  23.    h1=1/real((s+2*%pi*(15+100*%i))*(s+2*%pi*(15-100*%i)));
  24.    h1=syslin('c',h1)
  25.    bode(h1,10,1000,.01),
  26.    halt()
  27.    cw=xget("window");if cw>=1 then;ccw=cw-1;else ccw=cw+1;end
  28.    xbasc(cw);   xbasc(ccw);
  29.  
  30. //Third plot which combines the first two plots
  31.    bode([h1;sl],.1,1000,.01);
  32.  
  33.    halt()
  34.  
  35.    cw=xget("window");if cw>=1 then;ccw=cw-1;else ccw=cw+1;end
  36.    xbasc(cw);   xbasc(ccw);
  37.  
  38. // series connection
  39.    bode(h1*sl,.1,1000,.01);
  40.  
  41.    halt()
  42.  
  43.    cw=xget("window");if cw>=1 then;ccw=cw-1;else ccw=cw+1;end
  44.    xbasc(cw);   xbasc(ccw);
  45.